package com.ncmmall.application.securitys.authority;

import com.ncmmall.domain.security.auth.Authority;
import com.ncmmall.domain.security.auth.AuthorityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 权限管理
 *
 * @author linxs
 */
@Service
@Transactional
public class AuthoritysApplication {

    @Autowired
    private AuthorityRepository authorityRepository;

    /**
     * 添加权限
     *
     * @param authority
     * @return
     */
    public Authority create(Authority authority) {
        authorityRepository.save(authority);
        return authority;
    }

    /**
     * 修改权限
     *
     * @param authority
     */
    public void modify(Authority authority) {
        authorityRepository.save(authority);
    }

    /**
     * 删除权限
     *
     * @param authority
     */
    public void remove(Authority authority) {
        authorityRepository.delete(authority);
    }
}
